package com.peng.script;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
import java.util.stream.Collectors;

import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.peng.utils.JacksonUtil;

/**
 * LaborDay22
 *
 * @author lupeng
 * Created on 2022-04-28
 */
public class LaborDay22 {

    private static final Logger logger = LoggerFactory.getLogger(LaborDay22.class);

    public static void main(String[] args) throws IOException {
        String string = FileUtils.readFileToString(new File("/Users/hou/Desktop/scene-1.json"), "utf-8");
        Collection<Item> items = JacksonUtil.ofJsonCollection(string, ArrayList.class, Item.class);
        Set<Long> collect = items.stream().map(Item::getUserId).collect(Collectors.toSet());
        System.out.println(JacksonUtil.toJson(collect));
    }


    static class Item {

        private long id;
        private long userId;
        private Integer type;
        private Integer activityId;
        private Integer resourceId;
        private Integer status;
        private Long updateTime;
        private Long triggerTime;
        private String operator;

        public long getId() {
            return id;
        }

        public void setId(long id) {
            this.id = id;
        }

        public long getUserId() {
            return userId;
        }

        public void setUserId(long userId) {
            this.userId = userId;
        }

        public void setUserId(Integer userId) {
            this.userId = userId;
        }

        public Integer getType() {
            return type;
        }

        public void setType(Integer type) {
            this.type = type;
        }

        public Integer getActivityId() {
            return activityId;
        }

        public void setActivityId(Integer activityId) {
            this.activityId = activityId;
        }

        public Integer getResourceId() {
            return resourceId;
        }

        public void setResourceId(Integer resourceId) {
            this.resourceId = resourceId;
        }

        public Integer getStatus() {
            return status;
        }

        public void setStatus(Integer status) {
            this.status = status;
        }

        public Long getUpdateTime() {
            return updateTime;
        }

        public void setUpdateTime(Long updateTime) {
            this.updateTime = updateTime;
        }

        public Long getTriggerTime() {
            return triggerTime;
        }

        public void setTriggerTime(Long triggerTime) {
            this.triggerTime = triggerTime;
        }

        public String getOperator() {
            return operator;
        }

        public void setOperator(String operator) {
            this.operator = operator;
        }
    }

}
